package com.aiju.cash.core.api;

import com.aiju.app.config.ConfigManager;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

/**
 * @author: 佐为
 * @date: 2017-01-03 16:54
 * @version: V1.0
 * @Description: 描述
 */
public class MessageApi {

    private String list = ConfigManager.INIT_SERVER_HOST + "/message/list";

    private String getBySerialNum = ConfigManager.INIT_SERVER_HOST + "/deal/getBySerialNum";

    /**
     * 消息列表(店长)
     *
     * @param token   令牌
     * @param storeId 店铺编号
     */
    public void listByAdmin(String storeId, String token, String currentNum, String pageSize, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(list)
                .addParams("token", token)
                .addParams("currentNum", currentNum)
                .addParams("pageSize", pageSize)
                .addParams("storeId", storeId)
                .build()
                .execute(callback);
    }

    /**
     * 消息列表（收银员）
     *
     * @param token   令牌
     * @param operatorId 操作编号
     */
    public void listByClerk(String operatorId, String token, String currentNum, String pageSize, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(list)
                .addParams("token", token)
                .addParams("currentNum", currentNum)
                .addParams("pageSize", pageSize)
                .addParams("operatorId", operatorId)
                .build()
                .execute(callback);
    }

    /**
     * 消息点击到流水
     *
     * @param token   令牌
     * @param serialNum 操作编号
     */
    public void getBySerialNum(String serialNum, String token,StringCallback callback) {
        OkHttpUtils
                .post()
                .url(getBySerialNum)
                .addParams("token", token)
                .addParams("serialNum", serialNum)
                .build()
                .execute(callback);
    }
}
